Retrieving a Position

This example shows how to get the current position. This example uses the INavigate80 (GetPosition) method.

 

private void m_cNavigate()

        {

            try

            {

                var SGWorld = new SGWorld80();

                // get our current position

                var currentPos = SGWorld.Navigate.GetPosition(AltitudeTypeCode.ATC_TERRAIN_ABSOLUTE);

                // show details of current position

                MessageBox.Show(string.Format(

@"Current position in the world:

Altitude = {0}

AltitudeType = {1}

Distance = {2}

Yaw = {3}

Pitch = {4}

Roll = {5}

X = {6}

Y = {7}

", currentPos.Altitude, currentPos.AltitudeType, currentPos.Distance, currentPos.Yaw, currentPos.Pitch, currentPos.Roll, currentPos.X, currentPos.Y));

            }

            catch (Exception ex)

            {

                MessageBox.Show("Unexpected error: " + ex.Message);

            }

        }